package databook.help;

import java.io.IOException;
import java.net.URL;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.StyledDocument;

public class helpFrame extends JFrame {
	public final static int FILTER = 0;
	public final static int DIAGRAM = 1;
	public final static int DETAILS = 2;
	
	public static final int NUMBER = 3;
	
	public helpFrame(int type) {
//		this.setTitle(title);

		helpPane = new JTextPane();
		URL pageURL;
		
		
		switch (type) {
		case FILTER:
			pageURL = getClass().getResource("filter.html");
			break;
		case DETAILS:
			pageURL = getClass().getResource("details.html");
			break;
		case DIAGRAM:
		default:
			pageURL = getClass().getResource("diagram.html");
			break;
		}
		
		helpPane.setEditable(false);
		try {
			helpPane.setPage(pageURL);
		} catch (IOException e) {
			helpPane.setText(e.getLocalizedMessage());
		}
		
		scrollPane = new JScrollPane(helpPane);
		scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		this.add(scrollPane);
		
		this.setSize(700, 500);
	}
	
	
	
	
	private JTextPane helpPane;
	private JScrollPane scrollPane;
	
}
